//--------------------------------------------------------------
//
// Qizhi Zhang 
// ezhung@gmail.com
// http://www.moorwind.com
//
//--------------------------------------------------------------
package reader.dao
{
	import flash.data.SQLResult;
	
	public interface IBaseDAO
	{
		/**
         * Execute a query, applying the given parameters, and return the result.
         * The parameters Object represents an associative array of key/value pairs that correspond
         * to identifiers (minus the ":" prefix) present in the query. 
         * @param query Query to execute.
         * @param parameters Parameters to apply to query, or null if none need to be applied.
         */ 
		function execute(query:String, parameters:Object, prefetch:int = -1):SQLResult;
		
		/**
         * Execute a update query, and return true if it completed.
         * The parameters Object represents an associative array of key/value pairs that correspond
         * to identifiers (minus the ":" prefix) present in the query. 
         * @param query Query to execute.
         * @param data Data to apply to query, or null if none need to be applied.
         */ 
		function update(query:String, data:Object):Boolean;
		
		/**
         * Execute a delete query, and return true if it completed.
         * The parameters Object represents an associative array of key/value pairs that correspond
         * to identifiers (minus the ":" prefix) present in the query. 
         * @param query Query to execute.
         * @param data Data to apply to query, or null if none need to be applied.
         */ 
		function drop(query:String, data:Object):Boolean;
		
		/**
         * Execute a select query, return total number of items.
         * @param query Query to execute.
         * @param data Data to apply to query, or null if none need to be applied.
         */ 
		function count(query:String, data:Object):uint;
	}
}